(function(){
var initRule = function(){
	var f = document.forms["configform"],
	    fe = f.elements;
	var bar = document.getElementById("ruleplace");
	var twidth = parseFloat(fe["screen-width"].value),
	    rWidth =  parseFloat(fe["resolution-width"].value),
	    one = rWidth/twidth;
	for(var i = 0; i < 312; i++){
		var kedu = document.createElement("div");
		kedu.className = "kedu";
		bar.appendChild(kedu);
		var left = i*one*5;
		kedu.style.left = left+"px";
		var num = document.createElement("span");
		num.innerHTML = i*5;
		bar.appendChild(num);
		num.className="num";
		num.style.left = left+2 +"px";
	}	
}
var initForm = function(){
	var f = document.forms["configform"],
	    fe = f.elements,
	    size,
	    scselect = fe["screenSize"],
	    rcselect = fe["resolution"];
	if(scselect.value != ''){
		size = scselect.value.split("*");
		fe["screen-width"].value =size[0];
		fe["screen-height"].value =size[1];
	}
	if(rcselect.value != ''){
		size = rcselect.value.split("*");
		fe["resolution-width"].value = size[0];
		fe["resolution-height"].value = size[1];
	}

}
window.init = function(){
	initForm();
	initRule();
}
})()
